package com.study.agp;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.navigation.ui.AppBarConfiguration;

import com.study.agp.databinding.ActivityDataBinding;
import com.study.agp.room.AppDatabase;
import com.study.agp.room.UserDao;
import com.study.agp.room.UserEntity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        resetData();
    }

    private void resetData() {
        UserDao userDao = AppDatabase.getInstance(this).getUserDao();
        userDao.clearUserTable();
        long id = userDao.insert(new UserEntity("3", "zhang", 10));
        id = userDao.insert(new UserEntity("4", "zhang", 20));
        id = userDao.insert(new UserEntity("5", "wang", 30));
        System.out.println(id);
    }
}